<?php
class UserRecomAction extends CommonAction {

	public function index(){

        import("ORG.Util.Page");

        $RecomGood = M('recom_good');
        $count = $RecomGood->count();
        $Page = new Page ($count , 15 );
        $show = $Page->show();
        $recomInfo = $RecomGood->limit( $Page->firstRow . ',' . $Page->listRows )->select();
		
        $this->assign( 'page' , $show );
        $this->assign( 'recomInfo' , $recomInfo );
        $this->display();
    }

	function review(){
		$status = $_GET['status'];
		$recomid = $_GET['id'];

		$this->assign('status',$status);
		$this->assign('recomid',$recomid);
		$this->display();
	}

	function addRecom(){
		$status = $_REQUEST['status'];
		$recomid = $_REQUEST['recomid'];
		$status_reason = $_REQUEST['status_reason'];

		$RecomGood = M('recom_good');
		if ( !empty($recomid) ) {
        	$data['status'] =  $status;
        	$data['id'] = $recomid;
			$data['status_reason'] = $status_reason;
			$data['status_time'] = date('Y-m-d H:i:s');
            $list = $RecomGood->save($data);
        }
        if ($list !== false) {
        	$this->assign("jumpUrl","__URL__/index");
            $this->success(' ');
        } else {
        	$this->assign("jumpUrl","__URL__/index");
            $this->error(' ');
        }
	}

}
?>